package com.v2.k9;


import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 测试spring避免自己注入自己
 */
public class Test {

	public static void main(String[] args) {

		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfig.class);

		User user = (User)applicationContext.getBean("user");
		//避免自己注入自己
		System.out.println("user = "+user+" ; user.userName = "+user.getUserName()); //user = com.v2.k9.User@6279cee3 ; user.userName = user0
		System.out.println("user.user = "+user.user+" ; user.user.userName = "+user.user.getUserName()); //user.user = com.v2.k9.User@4206a205 ; user.user.userName = user1

//		User user = new User("12");
//		System.out.println(user);

	}
}
